package com.taotao.netty.socket.heartbeat;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.timeout.IdleStateHandler;

import java.util.concurrent.TimeUnit;

/**
 * @Description: 心跳initializer
 * @Author: TaoJF
 * @Date: Created in 2018/6/30 上午10:44
 */
public class MyServerInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(new IdleStateHandler(10, 15, 5, TimeUnit.SECONDS));
        pipeline.addLast(new MyServerHandler());
    }
}
